package com.itheima.Demo01.Tesk;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;

public class Test03 {
    public static void main(String[] args) {
        String S = "2018-02-14";
        LocalDate parse = LocalDate.parse(S);
        DayOfWeek dayOfWeek1 = parse.getDayOfWeek();
        System.out.println(dayOfWeek1);
        System.out.println("----------");
        LocalDate of = LocalDate.of(2018, 2, 14);
        DayOfWeek dayOfWeek = of.getDayOfWeek();
        System.out.println(dayOfWeek);
//        method02();

    }

    private static void method02() {
        Calendar C = Calendar.getInstance();
        C.set(2018, 2, 14);
        int i = C.get(Calendar.DAY_OF_WEEK);
        String S = week(i);
        System.out.println(S);
    }

    private static String week(int i) {
        String[] arr = {"", "星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
        return arr[i];
    }
}
